package com.blb.trans.mapper;

import com.blb.trans.entity.Account;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

/**
 * 账户映射接口
 */
public interface AccountMapper {

    /**
     * 按照id更新余额
     * @param id
     * @param balance
     */
    @Update("update account set account_balance = #{balance}" +
            " where account_id = #{id}")
    void updateBalanceById(@Param("id") Long id,
                           @Param("balance") Long balance);

    /**
     * 按id查账户
     * @param id
     * @return
     */
    @Select("select * from account where account_id = #{id}")
    Account selectById(Long id);
}
